package com.kevinxiaoge.ruoli.strategy_model;

import java.util.HashMap;
import java.util.Map;

/**
 * @author chengyuanyuan
 */
public class StrategyFactory {
    private static StrategyFactory factory = new StrategyFactory();

    private static Map<ReChargeTypeEnum, Strategy> map = new HashMap<>();
    static {
        map.put(ReChargeTypeEnum.E_BANK, new EBankStrategy());
        map.put(ReChargeTypeEnum.BUSI_ACCOUNTS, new BusiAcctStrategy());
        map.put(ReChargeTypeEnum.MOBILE, new MobileStrategy());
        map.put(ReChargeTypeEnum.CARD_RECHARGE, new CardStrategy());
    }
    /**
     * getInstance方法进行初始化
     * @return
     */
    public static StrategyFactory getInstance() {
        return factory;
    }

    public Strategy creator(ReChargeTypeEnum type) {
        return map.get(type);
    }
}
